Servlet = new Class({
			data : {},
			responseCall : null,
			initialize : function(forward) {
				if(forward){
					this.data.forward = forward;
				}
				this.data.random = Math.random();
			},
			submit : function(url) {
				var _responseCall = this.responseCall;
				new Request.JSONP({
							url : url,
							data:this.data,
							callbackKey: 'jsoncallback',
							onComplete : function(responseJson) {
								if (responseJson.status == "fail") {
									alert(responseJson.message);
									return;
								}
								if (_responseCall) {
									_responseCall(responseJson);
								}

							}
						}).send();
			}

		});

UserDefine = new Class({
			success : "",
			initialize : function(successFun) {
				this.success = successFun;
			},
			getUserDefineList : function(url) {
				var request = new Request.JSONP({
							url : url,
							callbackKey: 'jsoncallback',
							onComplete :this.success
						}).send('random=' + Math.random());
			}
		});

InventoryClassTree = new Class({
			tree : {},
			initialize : function(url) {
				this.tree = new Mif.Tree({
					container : $('tree_container'),// tree container
					types : {// node types
						folder : {
							openIcon : 'mif-tree-open-icon',// css class open
							// icon
							closeIcon : 'mif-tree-close-icon'// css class
							// close icon
						}
					},
					dfltType : 'folder',// default node type
					height : 18
						// node height
					});
				this.loadInventoryClassTree(url);
			},
			loadInventoryClassTree : function(url) {
				var _tree = this.tree;
				new Request.JSONP({
							url : url,
							data:{forward:"listMootoolsTreeData",random:Math.random()},
							callbackKey: 'jsoncallback',
							onComplete : success
						}).send();

				function success(jsonObj) {
					//var jsonObj = JSON.decode(responseText);// eval('('+responseText+')');
					if (jsonObj.status == "fail") {
						alert(jsonObj.message);
						return;
					}
					_tree.load({
								json : [jsonObj]
							});
				}
			}

		});
InventoryClassTree.implement({
			getSelectedNode : function() {
				return this.tree.getSelected();
			},
			isSelectedEffectNode : function() {
				if (this.tree && this.getSelectedNode()) {
					if (!this.getSelectedNode().children
							|| this.getSelectedNode().children.length == 0) {
						return true;
					}
				}
				return false;
			}
		});
 
